package com.pzhu.controller.wx;

import com.pzhu.model.dto.CouponDto;
import com.pzhu.model.help.ResponseResult;
import com.pzhu.service.CouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @Author : zqh
 * @Date : 2024/1/2 0002 下午 7:34
 * @Version: 1.0
 */
@Api("优惠卷相关接口")
@RestController
@RequestMapping("/wx/coupon")
public class WxCouponController {

    @Autowired
    private CouponService couponService;

    @ApiOperation("详情页")
    @GetMapping("/findFit")
    public ResponseResult findFit(@Valid CouponDto couponDto) {
        return couponService.findFit(couponDto);
    }

    @ApiOperation("查询优惠券个数")
    @GetMapping("/findCount/{id}")
    @ApiImplicitParam(name = "id",value = "用户ID",required = true)
    public ResponseResult findCount(@PathVariable(value = "id") Long id){
        return couponService.findCount(id);
    }
}
